package com.it.App.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.it.App.entity.SysUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: CaoYouGen
 * @DateTime: 2023/11/22/12:25
 * @注释: TODO
 **/
@Mapper
public interface SysUserMapper extends BaseMapper<SysUser> {

    @Select("select sm.perms\n" +
            "from sys_user su\n" +
            "         join sys_user_role sur on sur.user_id = su.id\n" +
            "         join sys_role sr on sur.role_id = sr.id\n" +
            "         join sys_role_menu srm on sr.id = srm.role_id\n" +
            "         join sys_menu sm on srm.menu_id = sm.id\n" +
            "where su.id = #{userId}")
    List<String> getMenuByUserId(Long userId);
}
